<?php
class Default_RestController extends Cff_Controller_Action {
	public function preDispatch() {
		$this->domain = 'http://' . $_SERVER ['SERVER_NAME'];
	}
	public function restAction() {
		$server = new Zend_Rest_Server ();
		$server->setClass ( 'Default_Service_Rest', "rest" );
		$server->handle ();
	}
	
	public function indexAction() {
		echo $this->domain . "/default/rest/rest/<br/>";
		try {
			$client = new Zend_Rest_Client ( $this->domain . "/default/rest/rest" );
			
			//测试1
			$result = $client->testFun1 ("sfsdfsdfsdf")->get ();
			print_r ( $result );	
// 			print_r ( $result->getIterator()->testFun1 );//返回结果
// 			exit;
			
			//测试2
			$args =  array("dfdf"=>"dfdsfsdfsdfsdf");
			$result = $client->testFun ($args )->get ();
			print_r($result->status());
			print_r ( $result );
// 			print_r ( $result->getIterator()->testFun );//返回结果
			
		} catch ( Exception $e ) {
			die ( 'ERROR: ' . $e->getMessage () );
		}
	}

}